<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <h1>更改产品中心</h1>
   <div>
       <input type="text" readonly v-model="p.id">
       <input type="text" v-model="p.title">
       <input type="text" v-model="p.price">
       <input type="text" v-model="p.saleCount">
       <input type="button" value="更改" @click="update">
   </div>
<script src="js/vue.js"></script>
<script src="js/axios.min.js"></script>
<script>
    let v = new Vue({
        el:"div",
        data:{
           p:{}
        },
        created: function () {
            let id = location.search.split("=") [1]
            axios.get("/selectById?id="+id).then(function (response) {
                v.p= response.data;
            })
        },methods:{
            update(){
                axios.post("/update",v.p).then(function (response) {
                    alert("更改成功")
                    location.href="/select.html";
                })
            }
        }
    })
</script>
</body>
</html>